<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="this.bannerImg" />
      <div class="banner-info">
        <div class="banner-title">
          {{this.sightName}}
        </div>
        <div class="banner-number">
          <span class = "iconfont banner-icon">&#xe796;</span>
          {{this.gallaryImgs.length}}
        </div>
      </div>
    </div>
    <fade-anim>
      <common-gallary
        :imgs="gallaryImgs"
        v-show="showGallary"
        @close="handleGallaryHidden">
      </common-gallary>
    </fade-anim>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary.vue'
import FadeAnim from 'common/fade/FadeAnimation.vue'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data () {
    return {
      showGallary: false,
      imgs: ['http://img1.qunarzz.com/sight/p0/1708/2b/2b3b94de99c0a425a3.img.jpg_r_800x800_ae28174d.jpg', 'http://img1.qunarzz.com/sight/p0/1908/e0/e0ee4f5e3ec59d14a3.img.jpg_r_800x800_fe02a2d6.jpg']
    }
  },
  components: {
    CommonGallary,
    FadeAnim
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallaryHidden () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position :relative
    overflow : hidden
    height : 0
    padding-bottom : 55%
    .banner-img
      width : 100%
    .banner-info
      position : absolute
      display : flex
      left : 0
      right : 0
      bottom : 0
      line-height : .6rem
      color : #fff
      background-image : linear-gradient(top, rgba(0, 0, 0, 0),rgba(0, 0, 0, .8))
      .banner-title
        flex : 1
        font-size : .32rem
        padding : 0 .2rem
      .banner-number
        padding : 0 .4rem
        line-height : .32rem
        height : .32rem
        margin-top : .14rem
        font-size : .24rem
        border-radius : .2rem
        background : rgba(0, 0, 0, .8)
        .banner-icon
          font-size : .24rem
</style>
